package com.hjm.project.eagle.eagleinfo.controller;

import com.hjm.common.utils.poi.ExcelUtil;
import com.hjm.framework.aspectj.lang.annotation.Log;
import com.hjm.framework.aspectj.lang.enums.BusinessType;
import com.hjm.framework.web.controller.BaseController;
import com.hjm.framework.web.domain.AjaxResult;
import com.hjm.framework.web.page.TableDataInfo;
import com.hjm.project.eagle.eagleinfo.domain.EagleInfo;
import com.hjm.project.eagle.eagleinfo.service.IEagleInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 雏鹰计划报名记录Controller
 *
 * @author wyj
 * @date 2021-10-27
 */
@Controller
@RequestMapping("/eagle/eagleInfo")
public class EagleController extends BaseController
{
    private String prefix = "eagle/eagleInfo";

    @Autowired
    private IEagleInfoService eagleInfoService;

    /**
     *前往雏鹰计划报名记录页面
     * @Param []
     * @Return java.lang.String
     */
    @RequiresPermissions("eagle:eagleInfo:view")
    @GetMapping("/view")
    public String eagleInfo()
    {
        return prefix + "/eagleInfo";
    }

    /**
     * 获取雏鹰计划报名记录信息
     */
    @RequiresPermissions("eagle:eagleInfo:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo selectEagleInfoList(EagleInfo eagleInfo) {
        startPage();
        List<EagleInfo> list = eagleInfoService.selectEagleInfoList(eagleInfo);
        return getDataTable(list);
    }

    /**
     * 导出雏鹰计划报名记录信息
     */
    @RequiresPermissions("eagle:eagleInfo:exportExcel")
    @Log(title = "雏鹰计划报名记录导出", businessType = BusinessType.EXPORT)
    @PostMapping("/exportExcel")
    @ResponseBody
    public AjaxResult exportExcel(EagleInfo eagleInfo)
    {
        List<EagleInfo> list = eagleInfoService.selectEagleInfoList(eagleInfo);
        ExcelUtil<EagleInfo> util = new ExcelUtil<EagleInfo>(EagleInfo.class);
        return util.exportExcel(list, "雏鹰计划报名记录");
    }
}
